<template>
  <el-dialog v-model="dialogFormVisible" title="店铺注销" width="600">
    <el-button @click="payOrder">确认注销店铺</el-button>
  </el-dialog>
</template>
  
<script lang="ts" setup>
import { deleteShopByIdAndJwt } from "../../api/shop/"
import { ElMessage } from 'element-plus'

const id = ref(0);

//打开本ShopDelete页
const dialogFormVisible = ref(false)
const openDialog = (shopId: number) => {
  dialogFormVisible.value = true
  id.value = shopId
}
defineExpose({
  openDialog
})

// 支付订单
const payOrder = () => {
  const payOrderResult = deleteShopByIdAndJwt({ id: id.value })
  payOrderResult.then((res) => {
    if (res.code === 200) {
      return ElMessage({
        showClose: true,
        message: '店铺注销成功',
        type: 'success',
      })
    } else {
      return ElMessage({
        showClose: true,
        message: res.message,
        type: 'error',
      })
    }
  })
}


</script>
  
<style scoped>
.layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}

.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}

.layout-container-demo .el-menu {
  border-right: none;
}

.layout-container-demo .el-main {
  padding: 0;
}

.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>
  